<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/
$router->get('/', function () use ($router) {
    return $router->app->version();
});

$router->options('{path:.*}', function () {
    return response('', 200);
});

//添加小区
$router->group(['prefix' => 'community'], function () use ($router) {
    $router->post('community_save', 'CommunityController@save');//保存小区
    $router->post('add_list_Storied', 'CommunityController@add_list_Storied');//添加单元 楼层 门牌号
    $router->post('community_list', 'CommunityController@lists');//小区列表
    $router->post('community_list_num', 'CommunityController@listNum');//小区数量
    $router->post('community_delete', 'CommunityController@delete_Community');//删除小区
    $router->post('community_update', 'CommunityController@update_Community');//修改小区
    $router->get('community_list', 'CommunityController@lists');//小区列表
    $router->post('community_one', 'CommunityController@getCommunityById');//渲染修改页面
    $router->post('community_upd', 'CommunityController@update_Community');//修改小区
    $router->post('household_list', 'CommunityController@household_list');//住户记录列表
    $router->post('household_list_num', 'CommunityController@household_list_num');//住户记录数
    $router->post('delete_household', 'CommunityController@delete_household');//删除住户表
    $router->get('/', 'CommunityController@communityList');//删除住户表

});
//小区公告
$router->group(['prefix' => 'notice'], function () use ($router) {
    $router->post('noticeSave', 'NoticeController@save');//保存公告
    $router->post('noticeOne', 'NoticeController@getNoticeById');
    $router->post('noticeUpd', 'NoticeController@update');//修改公告
    $router->post('noticeDel', 'NoticeController@delete');//删除公告
    $router->post('noticeIndex', 'NoticeController@index');//公告列表 分页 模糊查询记录
    $router->post('noticeIndexNum', 'NoticeController@indexNum');//公告列表记录数 模糊查询记录数
});
//保修管理
$router->group(['prefix' => 'repair'], function () use ($router) {
    $router->post('repairSave', 'RepairController@save');//保存报修记录
    $router->post('repairUpd', 'RepairController@update');//修改保修记录
    $router->post('repairOne', 'RepairController@getRepairById');//渲染修改页面 根据报修id获取详情
    $router->post('repairDel', 'RepairController@delete');//删除保修记录
    $router->post('repairIndex', 'RepairController@index');//保修记录列表 分页 模糊查询记录
    $router->post('repairIndexNum', 'RepairController@indexNum');//保修列表记录数 模糊查询记录数
});
//服务管理
$router->group(['prefix' => 'service'], function () use ($router) {
    $router->post('add', 'ServiceTypeController@save');//保存服务类型
    $router->post('get', 'ServiceTypeController@index');//获取服务类型
});
//缴费管理
$router->group(['prefix' => 'pay'], function () use ($router) {
    $router->post('save', 'WaterFeeController@save');//添加缴费记录 水电气通用
    $router->post('render', 'WaterFeeController@getWaterById');//渲染修改页面 水电气通用
    $router->post('update', 'WaterFeeController@update');//修改缴费记录 水电气通用

    $router->post('water_del', 'WaterFeeController@delete');//删除水费记录
    $router->post('water_lists', 'WaterFeeController@index');//水费记录列表
    $router->post('water_lists_num', 'WaterFeeController@indexNum');//水费记录数

    $router->post('electric_del', 'ElectricFeeController@delete');//删除电费记录
    $router->post('electric_lists', 'ElectricFeeController@index');//电费记录列表
    $router->post('electric_lists_num', 'ElectricFeeController@indexNum');//电费记录数

    $router->post('gas_del', 'GasFeeController@delete');//删除气费记录
    $router->post('gas_lists', 'GasFeeController@index');//气费记录列表
    $router->post('gas_lists_num', 'GasFeeController@indexNum');//气费记录数

//*************************************************************

    $router->post('property_save', 'PropertyFeeController@save');//添加缴费记录 物业、垃圾费通用
    $router->post('property_render', 'PropertyFeeController@getWaterById');//渲染修改页面 物业、垃圾费通用
    $router->post('property_update', 'PropertyFeeController@update');//修改缴费记录 物业、垃圾费通用

    $router->post('garbage_del', 'GarbageFeeController@delete');//删除垃圾费记录
    $router->post('garbage_lists', 'GarbageFeeController@index');//垃圾费记录列表
    $router->post('garbage_lists_num', 'GarbageFeeController@indexNum');//垃圾费记录数

    $router->post('property_del', 'PropertyFeeController@delete');//删除物业费记录
    $router->post('property_lists', 'PropertyFeeController@index');//物业费记录列表
    $router->post('property_lists_num', 'PropertyFeeController@indexNum');//物业费记录数
});
/*
 * 业主管理
 * */
$router->group(['prefix' => 'owner'], function () use ($router) {

    $router->post('owner_add', 'OwnerController@save');//添加业主
    $router->get('owner_delete', 'OwnerController@delete');//删除业主
    $router->get('owner_update_info', 'OwnerController@update_info');//修改业主信息 渲染页面
    $router->post('owner_update', 'OwnerController@update');//修改业主
    $router->post('owner_list', 'OwnerController@lists');//列表信息
    $router->post('page', 'OwnerController@page');//列表信息

    $router->post('total', 'OwnerController@total');//总条数

});
//车位管理
$router->group(['prefix' => 'park'], function () use ($router) {
//    $router->post('add_list_Storied','ParkSpaceController@addListStoried');//创建车位
    $router->post('add_list_Storied', 'ParkSpaceController@addParkSpace');//创建车位
    $router->post('delete_park', 'ParkSpaceController@deletePark');//删除车位
    $router->post('park_render', 'ParkSpaceController@parkRender');//渲染修改车位记录
    $router->post('park_update', 'ParkSpaceController@parkUpdate');//修改停车位
    $router->post('park_list_num', 'ParkSpaceController@parkListNum');//停车位表数量
    $router->post('park_list', 'ParkSpaceController@parkList');//停车位列表
    //$router->post('park_floor_list','ParkSpaceController@parkSpaceFloorList');//获取该小区所有楼号单元

    $router->post('park_list_index', 'ParkSpaceController@index');//停车位状态列表
    $router->post('park_save', 'ParkSpaceController@update');//保存停车位详情信息
    $router->post('park_one', 'ParkSpaceController@parkOne');//渲染点击停车位页面
    $router->post('index_park_floor', 'ParkSpaceController@indexParkFloor');//根据楼层获取停车位列表

    $router->post('add_community_park_floor', 'ParkSpaceController@addCommunityParkFloor');//添加小区停车位楼层
    $router->post('get_community_park_floor', 'ParkSpaceController@getCommunityParkFloor');//获取小区停车位楼层


});

/*
 * 文件上传
 * */
//$router->group(['prefix' => 'upload'], function () use ($router) {
//    $router->post('upload_images','UploadController@uploadImages');//多图片上传
//});

/*
 * 楼层管理
 * */
$router->group(['prefix' => 'floor'], function () use ($router) {
    $router->get('floor_list', 'FloorController@index');//获取该小区所有楼号单元
    $router->get('floor_list_info', 'FloorController@lists');//中间显示
});


/*
 * 登录
 * */
$router->group(['prefix' => 'login'], function () use ($router) {
    $router->post('login', 'AdminUsersController@login');
    $router->post('login_text', 'LoginController@text');//获取该小区所有楼号单元

});

$router->group(['middleware' => ['auth'], 'prefix' => 'login'], function () use ($router) {
    $router->post('user_info', 'AdminUsersController@userInfo');
});


